/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.service.impl;

import com.click.app.dao.CatalogDao;
import com.click.app.model.LabelValue;
import com.click.app.model.Catalog;
import com.click.app.model.Category;
import com.click.app.service.CatalogManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author arnold
 */
public class CatalogManagerImpl extends GenericManagerImpl<Catalog, Long> implements CatalogManager {

    CatalogDao catalogDao;

    public CatalogManagerImpl(CatalogDao catalogDao) {
        super(catalogDao);
        this.catalogDao = catalogDao;
    }
    public List<Catalog> findById(Long id) {
        return catalogDao.findById(id);
    }

    public CatalogDao getCatalogDao() {
        return catalogDao;
    }

    public void setCatalogDao(CatalogDao catalogDao) {
        this.catalogDao = catalogDao;
    }
    public List<Catalog> findCatalogByCategory(Category category){
        return catalogDao.findCatalogByCategory(category);
    }
    public List<Catalog> findAllIds(List<Long> listIds){
        List<Catalog> res = new ArrayList<Catalog>();
        for (Iterator<Long> it = listIds.iterator(); it.hasNext();) {
            Long idLong = it.next();
            Catalog mat = this.get(idLong);
            if(mat!=null)
                res.add(mat);
        }
        return res;
    }

    public Catalog findCurrentCatalog(){
        return catalogDao.findCurrentCatalog();
    }

}

